package cn.edu.scau.cmi.hekaimin.abstractFactoryMethod;

import javafx.fxml.FXML;

import javafx.scene.control.Button;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;

import javafx.scene.control.TextArea;

import javafx.scene.control.ComboBox;

public class AbstractFactoryController {
	@FXML
	private TextArea textArea_1;
	@FXML
	private Button btn_1;
	@FXML
	private ComboBox comboBox;
	@FXML
	private ComboBox comboBox_2;

	public void init() {
		ObservableList<String> options = FXCollections.observableArrayList("身体受伤","汽车损坏","人员伤亡", "多种事故");
	    this.comboBox.setItems(options);
		this.comboBox.getSelectionModel().select(0);
		
		ObservableList<String> options2 = FXCollections.observableArrayList("PICC","PingAn");
	    this.comboBox_2.setItems(options2);
		this.comboBox_2.getSelectionModel().select(0);
	}
	@FXML
	public void showAction(ActionEvent event) {
		CompanyFactory cf = CompanyFactory.getCompanyFactory((String)this.comboBox_2.getValue());
	    
		this.textArea_1.setText(cf.show() +"保险公司:" + cf.getInsurance((String)this.comboBox.getValue()).getDetail());
		
	}
}
